import { createRouter, createWebHashHistory } from "vue-router";
import Index from "../Index.vue";
import Login from "../Login.vue";
const routes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    name: "login",
    component: Login,
  },
  {
    path: "/toRegister",
    name: "register",
    component: () => import("@/views/User/register.vue"),
  },
  {
    path: "/index",
    name: "index",
    component: Index,
    children: [
      {
        path: "/myBlog",
        name: "myBlog",
        component: () => import("@/views/myBlog/myBlog.vue"),
      },
      {
        path: "/perCenter",
        name: "perCenter",
        component: () => import("@/views/perCenter/personalCenter.vue"),
      },
      {
        path: "/drafts",
        name: "drafts",
        component: () => import("@/views/drafts/drafts.vue"),
      },
      {
        path: "/recycleBin",
        name: "recycleBin",
        component: () => import("@/views/recycleBin/recycleBin.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
